package hotel.model;

import hotel.entity.IEntity;
import hotel.exceptions.UserNullException;

public class Room implements IRoom, IEntity
{
	private String roomClass = null;
	private int beds = 0;
	private String name = null;
	private String surname = null;
	private int userID = 0;
	private int id = 0;
	
	@SuppressWarnings("unused")
	private Room(){}
	
	public Room(int id, String roomClass, int beds, String name, String surname, int userID)
	{
		this.id = id;
		this.roomClass = roomClass;
		this.beds = beds;
		this.name = name;
		this.surname = surname;
		this.userID = userID;
	}
	
	/**
	 * this method makes room empty
	 */
	public void leaveRoom()
	{
		name = null;
		surname = null;
		userID = 0;
	}
	
	/**
	 * this method makes room occupied by user
	 * @param user User, that occupy the room
	 * @param timeIn Time when user get in
	 * @param timeOut Time when user get out
	 */
	public void occupyRoom(IUser user)
	{
		name = user.getName();
		surname = user.getSurname();
		userID = user.getId();
	}
	
	/**
	 * This method return room occupant id, if he exist
	 * @return
	 * @throws UserNullException
	 */
	public int roomOccupant() throws UserNullException
	{
		if (userID != 0) return userID;
			else throw new UserNullException();
	}

	public String getRoomClass() {
		return roomClass;
	}

	public int getBeds() {
		return beds;
	}
	
	public int getId() {
		return id;
	}

	public String getName() {
		return name;
	}

	public String getSurname() {
		return surname;
	}

	public int getUserID() {
		return userID;
	}

	@Override
	public String getUsername() {
		return null;
	}
	
	
}
